package com.day6.test6_niming_inner_class;

/**
 * @author 小坡
 * @date 2022/9/8  9:32
 **/
public class Test6 {
    /*
     * 当方法的形式参数是接口或者抽象类时可以将匿名内部类作为实际参数进行传递
     * */
    public static void main(String[] args) {
        goSwimming(new Swimming() {
            @Override
            public void swim() {
                System.out.println("去游泳啦~");
            }
        });
    }

    //使用接口的方法
    public static void goSwimming(Swimming swimming) {
        swimming.swim();
    }
}

//游泳的接口
interface Swimming {
    void swim();
}